package leecode

func minOperations2807(nums []int) int {
	hashMap := make(map[int]int)
	for _, num := range nums {
		hashMap[num]++
	}
	//尽量一次删除三个
	var result int
	for _, count := range hashMap {
		if count == 1 {
			return -1
		} else {
			for count%3 != 0 {
				count = count - 2
				result++
			}
			result += count / 3
		}
	}
	return result
}
